package com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AutoCompleteTextView;
import android.widget.ListView;

import com.example.qingyiapp.service.entify.IntrodutioBean;
import com.example.qingyiapp.R;
import com.example.qingyiapp.service.entify.Databean;
import com.example.qingyiapp.service.entify.FindFriend;
import com.example.qingyiapp.service.entify.FindTJBean;
import com.example.qingyiapp.service.entify.FriendSquareBean;
import com.example.qingyiapp.service.entify.FriendXxBean;
import com.example.qingyiapp.service.presenter.PersenterMannaer;
import com.example.qingyiapp.service.view.IChildView;
import com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_adapter1.adapter_address_lv;
import com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_adapter2.adapter_address_lv2;
import com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_adapter3.adapter_address_lv3;
import com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_bean.JavaBean_lv;
import com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_bean.JavaBean_lv2;
import com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_bean.JavaBean_lv3;
import com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_bean.JavaBean_msg;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 */
public class Fragment_AddressUI extends Fragment {

    ListView listView;
    ListView listView2;
    ListView listView3;


    AutoCompleteTextView autoCompleteTextView;

    String baseUrl = "http://www.iqingyi.com/";

    private List<JavaBean_lv.DataBean.ScenicsBeanX> scenics = new ArrayList<>();

    private List<JavaBean_lv2.DataBean> data = new ArrayList<>();

    private List<JavaBean_lv3.DataBean> data1 = new ArrayList<>();



    IChildView iChildView = new IChildView() {

        @Override
        public void onSuccess(Databean s) {

        }

        @Override
        public void onError(String error) {

        }

        @Override
        public void ongetAddress_lvData(JavaBean_lv javaBean_lv) {
            JavaBean_lv.DataBean data = javaBean_lv.getData();
            scenics = data.getScenics();
            //Log.i("TagA","scenics:"+scenics.size());
            adapter_address_lv adapter_address_lv = new adapter_address_lv(scenics,getContext());
            //Log.i("TagA","scenics:"+scenics.size());
            listView.setAdapter(adapter_address_lv);

        }


        @Override
        public void ongetAddress_lvData2(JavaBean_lv2 javaBean_lv2) {
            data = javaBean_lv2.getData();
            adapter_address_lv2 adapter_address_lv2 = new adapter_address_lv2(data,getActivity());
            listView2.setAdapter(adapter_address_lv2);


        }


        @Override
        public void ongetAddress_lvData3(JavaBean_lv3 javaBean_lv3) {
            data1 = javaBean_lv3.getData();
            adapter_address_lv3 = new adapter_address_lv3(data1,getActivity());
            listView3.setAdapter(adapter_address_lv3);
        }

        @Override
        public void ongetAddress_lvData4(JavaBean_msg javaBean_lv4) {

        }

        @Override
        public void ongetfriendSquareBean(FriendSquareBean friendSquareBean) {

        }

        @Override
        public void ongetfindfriend(FindFriend findFriend) {

        }

        @Override
        public void getjsonstring(FindTJBean s) {

        }

        @Override
        public void getfriendxxbean(FriendXxBean friendXxBean) {

        }

        @Override
        public void getIntrodution1(IntrodutioBean introdutioBean) {

        }
    };
    private com.example.qingyiapp.ui.activity.fragment.fragment_AddressUI.address_adapter3.adapter_address_lv3 adapter_address_lv3;

    public Fragment_AddressUI() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        View inflate = inflater.inflate(R.layout.fragment_fragment__address_ui, container, false);
        listView = inflate.findViewById(R.id.lv);
        listView2 = inflate.findViewById(R.id.lv2);
        listView3 = inflate.findViewById(R.id.lv3);
        autoCompleteTextView = inflate.findViewById(R.id.autoText);

        PersenterMannaer persenterMannaer = new PersenterMannaer(getActivity(), baseUrl);
        persenterMannaer.onCreate();
        persenterMannaer.attchview(iChildView);
        persenterMannaer.getAddress_lv();
        persenterMannaer.getAddress_lv2();
        persenterMannaer.getAddress_lv3();


        return inflate;
    }


}
